﻿function EatAndDoit() {
    var silver = document.getElementById("silverlight");
    if (silver) {
        var content = silver.Content;
        if (content) {
            var sample = content.Sample;
            if (sample) {
                var eat = sample.Eat;
                if (eat) {
                    eat.Checked = true;

                    var doit = sample.Doit;
                    if (doit) {
                        doit.Click();
                    }
                    else
                        alert('Error: Could not find the Doit button!');
                }
                else
                    alert('Error: could not find Eat radio control!');
            }
            else
                alert('Error: could not find sample silverlight usercontrol');
        }
        else {
            alert('Error: could not find silverlight content!');
        }
    }
    else {
        alert('Error: Could not found silverlight control');
    }
}
